#include<iostream>
class Soldier
{
public:
	int count = 0;
	
		int addCount(int m, int capacity)
	{
		count = count + m;
		if (count >= capacity)
		{
			count = capacity;
			std::cout << "弹药已装满" << std::endl;
		}
		return count;
	}
		int gunWithSignals(int signall,int count)
	{
		int result = 0;
		if (signall > count)
		{
			for (; count > 0; --count)
			{
				signall--;				
			}
			std::cout << "弹药不足" << std::endl;
			result = signall;
		}
		else
		{
			for (; count >= 0; --count)
			{
				; 
			}
			result = 0;
		}
		return result;
	}
};
class Gun
{
public:	
	int capacity = 4;
	int getGunCapacity()
	{
	std::cout << "枪支容量为4" << std::endl;
	return 4;
	}
	
};

int main(int argc,char**argv)
{
	Gun gun;
	Soldier soldier;
	int t =4;
	int num = 6;
	/*int t = 0;
	std::cout << "输入每次装弹个数" << std::endl;
	std::cin >> t;
	soldier.addCount(t);
	int num = 0;;
	std::cout << "输入射击次数" << std::endl;
	std::cin >> num;*/
	int capacity = gun.getGunCapacity();
	int temp=soldier.addCount(t, capacity);
	int result1 = soldier.gunWithSignals(num, temp);
	std::cout << "剩余发射次数为："<<result1 << std::endl;
	while(result1 != 0)
	{
		temp = soldier.addCount(t, capacity);
		result1= soldier.gunWithSignals(result1,temp);
	}
	std::cout << "射击完成" << std::endl;
	std::cin >> t;
	return 0;
}